package com.showsu.editor.enums;

import com.showsu.editor.utils.Constant;
import lombok.AllArgsConstructor;
import lombok.Getter;

/**
 * @Author: jph
 * @Description: xhs作品是否收录枚举类
 * @Date: Created in 7:47 下午 2024/6/27
 * @Modified By:
 */
@Getter
@AllArgsConstructor
public enum XhsAwemeIsIncludedEnum {

    NotIncluded(0, "未收录"),
    Included(1, "收录"),
    Delete(2, "作品无法正常展示"),
    NoNotesFound(3, "没找到笔记"),
    Fail(5, "接口异常"),
    ;

    /**
     * 编码
     */
    final int code;

    /**
     * 描述
     */
    final String msg;

    public static XhsAwemeIsIncludedEnum getByCode(int code) {
        for (XhsAwemeIsIncludedEnum iEnum : XhsAwemeIsIncludedEnum.values()) {
            if (iEnum.getCode() == code)  {
                return iEnum;
            }
        }
        return XhsAwemeIsIncludedEnum.Fail;
    }

    public static String getIsIncludedStr(XhsAwemeIsIncludedEnum isIncludedEnum) {;
        switch (isIncludedEnum){
            case NotIncluded :
            case Included:
                return isIncludedEnum.getMsg();
            default:
                return Constant.analyzeHit7;
        }
    }
}
